package com.xdandroid.sample;

import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;

import com.xdandroid.hellodaemon.*;

public class MainActivity extends Activity {

    protected void onCreate(Bundle b) {
        super.onCreate(b);
        setContentView(R.layout.activity_main);
    }

    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_start: try {startService(new Intent(this, TraceServiceImpl.class));} catch (Exception ignored) {} break;
            case R.id.btn_white: IntentWrapper.whiteListMatters(this, "轨迹跟踪服务的持续运行"); break;
            case R.id.btn_stop: TraceServiceImpl.stopService(); break;
        }
    }

    //防止华为机型未加入白名单时按返回键回到桌面再锁屏后几秒钟进程被杀
    @Override public void onBackPressed() { IntentWrapper.onBackPressed(this); }
}
